package edu.pku.sei.modeler.editpolicies;

import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy;
import org.eclipse.gef.requests.CreateConnectionRequest;
import org.eclipse.gef.requests.ReconnectRequest;

import edu.pku.sei.modeler.model.structure.MetaNode;
import edu.pku.sei.modeler.uml.commands.UMLConnectionCreateCommand;

public abstract class UMLDiagramNodeEditPolicy extends GraphicalNodeEditPolicy {

	@Override
	protected Command getConnectionCompleteCommand(
			CreateConnectionRequest request) {
		UMLConnectionCreateCommand command = (UMLConnectionCreateCommand) request
				.getStartCommand();
		command.setTarget((MetaNode) getHost().getModel());
		return command;
	}


	@Override
	protected Command getReconnectSourceCommand(ReconnectRequest request) {
		return UnexecutableCommand.INSTANCE;
	}

	@Override
	protected Command getReconnectTargetCommand(ReconnectRequest request) {
		return UnexecutableCommand.INSTANCE;
	}

}
